package com.etc.dao;

import com.etc.entity.SysStaff;
import com.etc.entity.SysStaffExample;
import com.etc.entity.SysStaffKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface SysStaffMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int countByExample(SysStaffExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int deleteByExample(SysStaffExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    @Delete({
        "delete from sys_staff",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(SysStaffKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    @Insert({
        "insert into sys_staff (id, name, ",
        "phone, username, ",
        "password)",
        "values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{phone,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, ",
        "#{password,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(SysStaff record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int insertSelective(SysStaff record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    List<SysStaff> selectByExample(SysStaffExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, name, phone, username, password",
        "from sys_staff",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    SysStaff selectByPrimaryKey(SysStaffKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") SysStaff record, @Param("example") SysStaffExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") SysStaff record, @Param("example") SysStaffExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(SysStaff record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_staff
     *
     * @mbggenerated
     */
    @Update({
        "update sys_staff",
        "set name = #{name,jdbcType=VARCHAR},",
          "phone = #{phone,jdbcType=VARCHAR},",
          "username = #{username,jdbcType=VARCHAR},",
          "password = #{password,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysStaff record);
    List<SysStaff> findByAll();
}